/*************************************************************************
 * 
 *  fill histogramms at the end of an event
 * 
 *************************************************************************/

#ifndef EventAction_h
#define EventAction_h 1

#include "G4UserEventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "globals.hh"

class EventAction;

#include "MiniBallEventAction.hh"
#include "SiHit.hh"
#include "Data.hh"
#include "HistoManager.hh"
#include "SensitiveDetector.hh"


class EventAction : public MiniBallEventAction
{
public:
  EventAction(HistoManager*, Data*);
  ~EventAction();

public:
  void BeginOfEventAction(const G4Event*);
  void EndOfEventAction(const G4Event*);
        
private:
  void CD(bool forward, HitsCollection* first, HitsCollection* second=NULL);
  void BD(bool forward, HitsCollection* first, HitsCollection* second=NULL);
  HistoManager* histoManager;
  Data* data;
  G4int i;
  
  bool gammafound;
  bool fill;
  vector<G4int> collectionID;  
  vector<vector<int> > RingNumber;
  vector<vector<double> > RingEnergy;
  vector<vector<int> > StripNumber;
  vector<vector<double> > StripEnergy;
  vector<double> Edet;


};

#endif

    
